'use strict'

function count() {
    let arr = []

    for (var index = 1; index <= 3; index++) {
        arr.push(function aaa(i){
            return function (){
                return i * i;
            }
        }(index))
    }
    console.log(index);
    return arr;
}

let fn = count ()

let f1 = fn[0];
let f2 = fn[1];
let f3 = fn[2];

console.log(f1());
console.log(f2());
console.log(f3());



var obj = {
birth: 2000,
getAge: function () {
    var b = this.birth; 
    var fn = () => new Date().getFullYear() - this.birth; 
    return fn();
    }
};
console.log(obj.getAge());




var arr = [10, 20, 1, 2];
arr.sort((x, y) => {
    if (x < y) return -1;
    if (x > y) return 1; 
});
console.log(arr);